/*
 * PlayerType.java
 *
 * Created on May 11, 2006, 9:29 AM
 */

package poppitplayer.gui;

/**
 *
 * @author  Andrew
 */
public class PlayerType extends javax.swing.JFrame {
    
    /** Creates new form PlayerType */
    public PlayerType() {
        this.startForm = new Start();
        initComponents();
    }
    
    /** Creates new form PlayerType */
    public PlayerType(Start aForm) {
        this.startForm = aForm;
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jButtonNewGP = new javax.swing.JButton();
        jButtonLoadGP = new javax.swing.JButton();
        jButtonNewSearch = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Choose Player Type");
        jButtonNewGP.setText("New GP Player");
        jButtonNewGP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNewGPActionPerformed(evt);
            }
        });

        jButtonLoadGP.setText("Load GP Player");
        jButtonLoadGP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLoadGPActionPerformed(evt);
            }
        });

        jButtonNewSearch.setText("New Undirected Search Player");
        jButtonNewSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNewSearchActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jButtonNewSearch)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(47, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jButtonNewGP)
                    .add(jButtonLoadGP))
                .add(45, 45, 45))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(22, 22, 22)
                .add(jButtonNewGP)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButtonLoadGP)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButtonNewSearch)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonLoadGPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLoadGPActionPerformed
        this.startForm.gameType.gameType = "gp";
        this.startForm.gpPlayer.loadPlayer();
        this.setVisible(false);
        this.startForm.gameType.setVisible(true);
    }//GEN-LAST:event_jButtonLoadGPActionPerformed

    private void jButtonNewGPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewGPActionPerformed
        this.startForm.gameType.gameType = "gp";
        this.setVisible(false);
        this.startForm.gpPlayer.setVisible(true);
    }//GEN-LAST:event_jButtonNewGPActionPerformed

    private void jButtonNewSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewSearchActionPerformed
        this.startForm.gameType.gameType = "search";
        this.setVisible(false);
        this.startForm.searchPlayer.setVisible(true);
    }//GEN-LAST:event_jButtonNewSearchActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PlayerType().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonLoadGP;
    private javax.swing.JButton jButtonNewGP;
    private javax.swing.JButton jButtonNewSearch;
    // End of variables declaration//GEN-END:variables
    private Start startForm;
}
